home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 5 / Apprentice-Release5.iso / Environments / Prograph Classic 2.6.1 / Prograph Tutorial Manual / Prograph Tutorial / Prograph Tutorial.rsrc / TEXT_151.txt < prev    next >
Encoding:
Text File  |  1995-10-16  |  10.4 KB  |  161 lines

  1. t    User-supplied Help and Information
  2.  
  3. *788*The third item available from the ÀôInfo‚Ķ dialog, Universal Methods, provides a way to access user-supplied comments comparable to the comments supplied about built-in primitives. If the method developer does not add a comment to a method icon in the Universal Methods window, the entry for that method in the ÀôInfo‚Ķ dialog is empty. To provide *777*online documentation for the test method you just developed:
  4.  
  5. u    Activate the Universal Methods window and Command-click the test method icon. An insertion bar begins flashing next to the test method icon, indicating that Prograph is ready to accept your typed comment.
  6.  
  7. u    Type the following entry:
  8.  
  9.  Inputs:  none
  10.  
  11.  Outputs:  none
  12.  
  13.  A nonsense method developed in the Prograph
  14.  tutorial to showcase a dataflow execution
  15.  error using the choose primitive.
  16.  
  17. *778*Although you are not required to do so, it is a good idea to create comments in a format similar to Prograph‚Äôs built-in, *781*online documentation. By supplying an input and output specification followed by a text description of the behavior of the method, you provide an easily accessible form of information to others who use your method in the future.
  18.  
  19. u    Select*473* Universal Methods *1121*from the ÀôInfo‚Ķ dialog and click the test item in the scrolling list that pops up. (The list is not actually scrolling, since this single item is the only selection available.) Your comment annotation from the Universal Methods window is displayed in the text pane of the dialog.
  20.  
  21.  
  22.  
  23.  
  24.  
  25.  
  26.  
  27.  
  28.  
  29.  
  30.  
  31.  
  32. ________________________________________________________
  33. NOTE:  The comment you added in the Universal Methods window is displayed in the ÀôInfo‚Ķ dialog with the same line ending and carriage returns that you typed when the comment was added to the method icon.
  34.  
  35. If you want to supply long descriptive functional explanations of methods, the body of a paragraph entry should be one long line with no carriage returns. Then when comments are accessed from the ÀôInfo‚Ķ dialog, the text pane‚Äôs own text wrapping presents a compact and complete display of the extended comment.
  36.  
  37. You may find that a Prograph text window with text wrap turned on is more useful for the preparation of comments. To open a text window select*632* New Text‚Ķ *752*from the*369* File menu.
  38.  
  39. After you have finished a method description, copy and paste the text to the comment field of the method icon in the Universal Methods window. By saving the*923* text window in which these comments are developed, you then have a separate text file documenting your user-defined methods.
  40. ---------------------------------------------------------
  41.  
  42. To see the utility of user-supplied class, attribute, and method comments:
  43.  
  44. u    Open the file Association Class in the Ch 5 Δí folder (inside the Tutorial Examples Δí folder). (There is no need to keep the test method developed earlier, so simply click Discard when asked whether you want to save your current work before loading the new file.)
  45.  
  46. ___________________________________________________________
  47. NOTE:  You cannot open or save a file if your application is running. If such is the case, select Stop Running from the Exec menu.
  48. -----------------------------------------------------------
  49.  
  50. u    When the file is fully loaded, the Association class icon is seen in the Classes window. Open the Universal Methods window, Command-click to create a new method icon, name it test, and then open its case window.
  51.  
  52. u    Create an unspecified operation icon in the test case window and select *160* Classes from the ÀôInfo‚Ķ dialog.
  53.  
  54. u    Select the lone class item, Association, in the scrolling-list pane. The text pane displays a brief description of the nature and function of the Association class.
  55.  
  56.  
  57.  
  58.  
  59.  
  60.  
  61.  
  62.  
  63.  
  64.  
  65.  
  66.  
  67.  
  68. You can get further information about the structure and capabilities of a selected class by selecting Methods and Attributes from the ÀôInfo‚Ķ dialog. (Notice that these two items are available only when you‚Äôve selected a class.)
  69.  
  70. u    Select Attributes to see information on the two attributes, key and value, of the Association class. Click each of the items in the scrolling list to review the acceptable values these attributes can take on, and read the brief description.
  71.  
  72. u    Next, select Methods to see the list of available methods in the Association class. Take a minute or two to select each of the methods listed and review the input-output and functional specifications in the text pane of the dialog.
  73.  
  74. Just as you added notes to the test method earlier, the author of the Association class has supplied well-formatted, informative comments associated with each method icon in the Association class Methods window. In addition, the brief class description that is displayed when the class is selected is a user comment attached to the Association class icon in the Classes window.
  75.  
  76. ___________________________________________________________
  77. NOTE:  To take advantage of the ÀôInfo‚Ķ dialog text-wrap capability in the text pane, the Association class author has used the format of a single long line for comments.
  78.  
  79. To see the comments you have just inspected in the text pane of the dialog, open the Association class Methods window. Select*178* Show Comments *447**645**985*from the Info menu‚Äîall comments of all methods in the active window are displayed. While not very readable in this view, they are well suited for display in the ÀôInfo‚Ķ dialog. Select*175* Hide Comments *404**438*from*635* the Info menu before continuing. Activate the test universal method you were working on, reopen the ÀôInfo‚Ķ dialog for classes, select Association, and then select*465* Methods.
  80. -----------------------------------------------------------
  81.  
  82. u    Click the item*161* key&value and read its input-output specification and functional description.
  83.  
  84.  
  85.  
  86.  
  87.  
  88.  
  89.  
  90.  
  91.  
  92.  
  93.  
  94.  
  95.  
  96. The description tells you that the left terminal of a key&value method operation icon requires a string or number input, while the right terminal can take any object or data type value as input. The root of this operation returns an instance of the Association class with its key and value attributes set to their respective inputs.
  97.  
  98. u    Pull down the*471* Transfer *662**1108*pop-up menu.  Notice that the last three items, normally disabled, are now available. These items let you select the type*708* of method referencing*453* (slash-prefixes)*452* you want to transfer, along with the method name*467*, to the operation being named.*4**5**455**1109**1110**1111**1113*
  99.  
  100.  
  101.  
  102.  
  103.  
  104.  
  105. The*124* C/Name menu item prefixes the method name with the method‚Äôs class name and a slash character when it is transferred.
  106.  
  107. u    Select C/Name to paste the formatted *693**694**695*method*751* reference and*707* name into the unspecified method operation icon in the test universal method. When the test method case window reactivates, press Return to accept the name transferred from the dialog. The operation icon now reads Association/key&value and is formatted with two terminals and a single root.
  108.  
  109. Prograph method case diagrams are a form of high-level documentation as well as being the source code*724* for the method itself.
  110.  
  111. u    Double-click the operation‚Äôs right click spot (the diagonal patterned area to the right of the name text field). The case window for the key&value method immediately opens and is activated.
  112.  
  113.  
  114.  
  115.  
  116.  
  117.  
  118.  
  119.  
  120.  
  121.  
  122.  
  123.  
  124.  
  125.  
  126.  
  127.  
  128.  
  129. Inspecting the method, you confirm that the key&value method works in the manner described in the ÀôInfo‚Ķ dialog. When you close the key&value case window, the test method case window is again the active, top window with the key&value operation icon selected.
  130.  
  131. Interactively using the ÀôInfo‚Ķ dialog and popping up case windows of called methods are both useful techniques when developing new Prograph methods. The Primitives and Classes items provide significant online help and information (especially when user-developed classes are well commented), reducing your need to turn to external sources of information such as this manual and*488* Inside Macintosh.
  132.  
  133. Further, using the ÀôInfo‚Ķ dialog reduces program errors that result from typing mistakes and lapses in memory of method and attribute names.
  134.  
  135. ___________________________________________________________
  136. NOTE:  Using the ÀôInfo‚Ķ dialog to explore the available *454*attributes and methods of a class can be useful even when the class author has not supplied extensive comments like those in the Association class. Select a desired attribute or method, and then select Name to fill in the name of an operation icon in the method you are currently specifying. A quick double-click on the icon opens the referenced method‚Äôs own case window or, in a Get or Set operation, it shows the default value assigned to the referenced attribute. Dataflow-method *238*diagrams help you understand the requirements and performance of a method, and you can reduce errors*1095* in your work by using the ÀôInfo‚Ķ dialog.
  137. -----------------------------------------------------------
  138.  
  139. The information for*468* Persistents *828*is similar in appearance and function to that for*473* Universal Methods. Any online help or information available must be user-supplied. Comments are attached to the Persistent icon in the Persistents window in the same way that comments are added to icons in the Classes, Universal, and class Methods*716* windows.
  140.  
  141. t    Macintosh Online Information
  142.  
  143. *464**558*The last five items in the Category pop-up menu in the ÀôInfo‚Ķ dialog provide online information about Macintosh methods*461**545*, constants*458*, globals*460**544*, structures*463**547*, and fields*459**543*.
  144.  
  145.  
  146.  
  147.  
  148.  
  149.  
  150.  
  151.  
  152.  
  153.  
  154.  
  155.  
  156.  
  157. The information provided for these Mac items is relatively cursory. Most Prograph programming you do will be developed under Application Builder using Prograph primitives and System classes. System class instances and Prograph primitives provide high-level access to the Macintosh ROM and other Macintosh operating-system facilities. You do not have to manage directly the inner complexities of your machine in order to write sophisticated Macintosh applications.
  158.  
  159. *782*However, if you are a ‚ÄúMac hack‚Äù and have a copy of Inside Macintosh or another reference to the underpinnings of the Mac, you can fully and completely control the interface between your Prograph application and the Macintosh hardware; see *934*Reference chapter 7, ‚ÄúThe Macintosh Toolbox,*559*‚Äù for more information.  You can also find more about the use of Macintosh*929* QuickDraw ROM routines in the Application Builder tutorial on using graphics in*125* Canvas objects.
  160.  
  161.